package com.xinchuang.controller;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import java.util.*;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import com.xinchuang.utils.CheckUtil;
import com.xinchuang.comment.R;
import com.xinchuang.comment.ResultCode;
import com.google.gson.Gson;

import java.text.SimpleDateFormat;

import com.xinchuang.utils.DateUtils;
import org.springframework.web.multipart.MultipartFile;
import org.apache.commons.lang3.StringUtils;
import com.xinchuang.service.MoldManagementModService;

/**
 * MoldManagementModController
 *
 * @date 2023-07-05
 */
@RestController
@RequestMapping("/moldManagementMod")
@Api(value = "模具管理模块", tags = "模具管理模块")
public class MoldManagementModController {
    private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    @Resource
    private MoldManagementModService moldManagementModService;

    /**
     * 模具列表接口接口  函数名称moldList  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/moldList")
    @ApiOperation("模具列表接口")
    public R moldList(@RequestBody JSONObject jsonObject) {
        // 调用业务层代码
        String r = moldManagementModService.moldList(jsonObject);
        return JSON.parseObject(r, R.class);
    }

    /**
     * 添加模具接口接口  函数名称addMold  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/addMold")
    @ApiOperation("添加模具接口")
    public R addMold(@RequestBody JSONObject jsonObject) {
        String r = moldManagementModService.addMold(jsonObject);
        return JSON.parseObject(r, R.class);
    }

    /**
     * 编辑模具接口接口  函数名称editMold  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/editMold")
    @ApiOperation("编辑模具接口")
    public R editMold(@RequestBody JSONObject jsonObject, HttpServletRequest request) {
        String r = moldManagementModService.editMold(jsonObject, request);
        return JSON.parseObject(r, R.class);
    }

    /**
     * 删除模具接口接口  函数名称deleteMold  功能描述:
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/deleteMold")
    @ApiOperation("删除模具接口")
    public R deleteMold(@RequestBody JSONObject jsonObject) {
//        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
//        Set<String> sSet = new HashSet<>();
//        String result = jsonLoop(jsonObject, "", methodName + "SC", sSet);
//        result = result + deleteMoldACS(sSet);
//        if (result.length() > 0) {
//            return R.fail("入参：" + result);
//        } else {
//            // 调用业务层代码
            String r = moldManagementModService.deleteMold(jsonObject);
//            Set<String> aSet = new HashSet<>();
//            JSONObject o = JSON.parseObject(r);
//            if (o == null) {
//                o = new JSONObject();
//            }
//            result = jsonLoop(o.get("data"), "", methodName + "AC", aSet);
//            result = result + deleteMoldACB(aSet);
//            if (result.length() > 0) {
//                return R.fail("出参：" + result);
//            }
            return JSON.parseObject(r, R.class);
//        }
    }

    /**
     * 模具查询接口  函数名称queryMoldByName  功能描述:按照名称模糊查询，模具ID精确查询
     *
     * @param jsonObject 中文名:通用实体类
     * @return 返回参数{}
     */
    @PostMapping("/queryMoldByName")
    @ApiOperation("模具查询")
    public R queryMoldByName(@RequestBody JSONObject jsonObject) {
        String r = moldManagementModService.queryMoldByName(jsonObject);
        return JSON.parseObject(r, R.class);
    }


    public static String jsonLoop(Object object, String result, String methodName, Set<String> set) {
        Object v = null;
        if (object instanceof JSONArray || object instanceof ArrayList) {
            JSONArray jsonArray = new JSONArray();
            if (object instanceof ArrayList) {
                jsonArray = JSONArray.parseArray(JSON.toJSONString(object));
            } else {
                jsonArray = (JSONArray) object;
            }
            for (int i = 0; i < jsonArray.size(); i++) {
                result = jsonLoop(jsonArray.get(i), result, methodName, set);
                if (StringUtils.isNotEmpty(result)) {
                    return result;
                }
            }
        }
        if (object instanceof JSONObject) {
            JSONObject jsonObject = (JSONObject) object;
            for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
                Object o = entry.getValue();
                if (o instanceof JSONArray || o instanceof ArrayList) {
                    result += selectCheckMathod(entry.getKey(), entry.getValue(), methodName, set);
                    result = jsonLoop(o, result, methodName, set);
                    if (StringUtils.isNotEmpty(result)) {
                        return result;
                    }
                } else if (o instanceof JSONObject) {
                    result = jsonLoop(o, result, methodName, set);
                    if (StringUtils.isNotEmpty(result)) {
                        return result;
                    }
                } else {
//                   FIXME: 未知类型
                }
                v = entry.getValue();
                result += selectCheckMathod(entry.getKey(), v, methodName, set);
            }
        }
        return result;
    }

    private static String selectCheckMathod(String key, Object value, String methodName, Set<String> set) {
        String result = "";
        if ("moldListSC".equals(methodName)) {
            result = moldListSC(key, value, set);
        }
        if ("moldListAC".equals(methodName)) {
            result = moldListAC(key, value, set);
        }
        if ("addMoldSC".equals(methodName)) {
            result = addMoldSC(key, value, set);
        }
        if ("addMoldAC".equals(methodName)) {
            result = addMoldAC(key, value, set);
        }
        if ("editMoldSC".equals(methodName)) {
            result = editMoldSC(key, value, set);
        }
        if ("editMoldAC".equals(methodName)) {
            result = editMoldAC(key, value, set);
        }
        if ("deleteMoldSC".equals(methodName)) {
            result = deleteMoldSC(key, value, set);
        }
        if ("deleteMoldAC".equals(methodName)) {
            result = deleteMoldAC(key, value, set);
        }
        if ("queryMoldByNameSC".equals(methodName)) {
            result = queryMoldByNameSC(key, value, set);
        }
        if ("queryMoldByNameAC".equals(methodName)) {
            result = queryMoldByNameAC(key, value, set);
        }
        return result;
    }


    private static String moldListSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("moldId".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具编号", isNull, 0, 255);
        }
        if ("moldName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具名称", isNull, 0, 255);
        }
        if ("pageNum".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "页码", isNull, "1", "100000");
        }
        if ("pageSize".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "每页数量", isNull, "1", "1000");
        }
        if ("tongmanName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "钳工", isNull, 0, 255);
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String moldListAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("moldWeight".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具重量", isNull, 0, 255);
        }
        if ("code".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "状态码", isNull, "0", "100000");
        }
        if ("msg".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "返回消息", isNull, 0, 255);
        }
        if ("success".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if ("moldId".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具编号", isNull, 0, 255);
        }
        if ("moldName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具名称", isNull, 0, 255);
        }
        if ("customerName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "客户", isNull, 0, 255);
        }
        if ("tongmanName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "钳工", isNull, 0, 255);
        }
        if ("materialWeight".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "材料重量", isNull, 0, 255);
        }
        if ("projectManager".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "主要联络人", isNull, 0, 255);
        }
        if ("moldLook".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具外形", isNull, 0, 255);
        }
        if ("temperatureControlTime".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "几点温控（注明接口）", isNull, 0, 255);
        }
        if ("pourTime".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "几点浇注", isNull, 0, 255);
        }
        if ("hotSpotPairType".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "热点偶型号（J或K）", isNull, 0, 255);
        }
        if ("needHydraumaticStation".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "是否需要液压工作站", isNull, 0, 255);
        }
        if ("injectionMoldingTime".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "几点顺序注塑", isNull, 0, 255);
        }
        if ("hasLimitSwitch".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "是否有限位开关", isNull, 0, 255);
        }
        if ("hasTimeRelay".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "是否有时间继电器", isNull, 0, 255);
        }
        if ("materials".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "制件材料", isNull, 0, 255);
        }
        if ("color".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "制件颜色", isNull, 0, 255);
        }
        if ("samplePieceWeight".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "样件重量", isNull, 0, 255);
        }
        if ("totalNum".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "总条数", isNull, "0", "255");
        }
        if ("dataList".equals(key)) {
            result += CheckUtil.checkJSONArray(JSONArray.parseArray(JSON.toJSONString(value)), "dataList", isNull);
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String addMoldSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("moldWeight".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具重量", isNull, 0, 255);
        }
        if ("moldId".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具编号", isNull, 0, 255);
        }
        if ("moldName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具名称", isNull, 0, 255);
        }
        if ("customerName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "客户", isNull, 0, 255);
        }
        if ("tongmanName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "钳工", isNull, 0, 255);
        }
        if ("materialWeight".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "材料重量", isNull, 0, 255);
        }
        if ("projectManager".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "主要联络人", isNull, 0, 255);
        }
        if ("moldLook".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具外形", isNull, 0, 255);
        }
        if ("temperatureControlTime".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "几点温控（注明接口）", isNull, 0, 255);
        }
        if ("pourTime".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "几点浇注", isNull, 0, 255);
        }
        if ("hotSpotPairType".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "热点偶型号（J或K）", isNull, 0, 255);
        }
        if ("needHydraumaticStation".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "是否需要液压工作站", isNull, 0, 255);
        }
        if ("injectionMoldingTime".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "几点顺序注塑", isNull, 0, 255);
        }
        if ("hasLimitSwitch".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "是否有限位开关", isNull, 0, 255);
        }
        if ("hasTimeRelay".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "是否有时间继电器", isNull, 0, 255);
        }
        if ("materials".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "制件材料", isNull, 0, 255);
        }
        if ("color".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "制件颜色", isNull, 0, 255);
        }
        if ("samplePieceWeight".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "样件重量", isNull, 0, 255);
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String addMoldAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "状态码", isNull, "0", "100000");
        }
        if ("msg".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "返回消息", isNull, 0, 255);
        }
        if ("success".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String editMoldSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("moldId".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具编号", isNull, 0, 255);
        }
        if ("moldName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具名称", isNull, 0, 255);
        }
        if ("customerName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "客户", isNull, 0, 255);
        }
        if ("tongmanName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "钳工", isNull, 0, 255);
        }
        if ("materialWeight".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "材料重量", isNull, 0, 255);
        }
        if ("projectManager".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "主要联络人", isNull, 0, 255);
        }
        if ("moldLook".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具外形", isNull, 0, 255);
        }
        if ("temperatureControlTime".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "几点温控（注明接口）", isNull, 0, 255);
        }
        if ("pourTime".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "几点浇注", isNull, 0, 255);
        }
        if ("hotSpotPairType".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "热点偶型号（J或K）", isNull, 0, 255);
        }
        if ("needHydraumaticStation".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "是否需要液压工作站", isNull, 0, 255);
        }
        if ("injectionMoldingTime".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "几点顺序注塑", isNull, 0, 255);
        }
        if ("hasLimitSwitch".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "是否有限位开关", isNull, 0, 255);
        }
        if ("hasTimeRelay".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "是否有时间继电器", isNull, 0, 255);
        }
        if ("materials".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "制件材料", isNull, 0, 255);
        }
        if ("color".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "制件颜色", isNull, 0, 255);
        }
        if ("samplePieceWeight".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "样件重量", isNull, 0, 255);
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String editMoldAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "状态码", isNull, "0", "100000");
        }
        if ("msg".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "返回消息", isNull, 0, 255);
        }
        if ("success".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String deleteMoldSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("moldId".equals(key)) {
            isNull = true;
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具Id", isNull, 0, 255);
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String deleteMoldAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("code".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "状态码", isNull, "0", "100000");
        }
        if ("msg".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "返回消息", isNull, 0, 255);
        }
        if ("success".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String queryMoldByNameSC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("moldId".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具编号", isNull, 0, 255);
        }
        if ("moldName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具名称", isNull, 0, 255);
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String queryMoldByNameAC(String key, Object value, Set<String> set) {
        String result = "";
        Boolean isNull = false;
        if ("moldWeight".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具重量", isNull, 0, 255);
        }
        if ("code".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkBigDecimal(value == null ? "" : value.toString(), "状态码", isNull, "0", "100000");
        }
        if ("msg".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "返回消息", isNull, 0, 255);
        }
        if ("success".equals(key)) {
            // 判断参数类型: String  num boolean datetime
        }
        if ("moldID".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具编号", isNull, 0, 255);
        }
        if ("moldName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具名称", isNull, 0, 255);
        }
        if ("customerName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "客户", isNull, 0, 255);
        }
        if ("tongmanName".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "钳工", isNull, 0, 255);
        }
        if ("materialWeight".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "材料重量", isNull, 0, 255);
        }
        if ("projectManager".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "主要联络人", isNull, 0, 255);
        }
        if ("moldLook".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "模具外形", isNull, 0, 255);
        }
        if ("temperatureControlTime".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "几点温控（注明接口）", isNull, 0, 255);
        }
        if ("pourTime".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "几点浇注", isNull, 0, 255);
        }
        if ("hotSpotPairType".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "热点偶型号（J或K）", isNull, 0, 255);
        }
        if ("needHydraumaticStation".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "是否需要液压工作站", isNull, 0, 255);
        }
        if ("injectionMoldingTime".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "几点顺序注塑", isNull, 0, 255);
        }
        if ("hasLimitSwitch".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "是否有限位开关", isNull, 0, 255);
        }
        if ("hasTimeRelay".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "是否有时间继电器", isNull, 0, 255);
        }
        if ("materials".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "制件材料", isNull, 0, 255);
        }
        if ("color".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "制件颜色", isNull, 0, 255);
        }
        if ("samplePieceWeight".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "样件重量", isNull, 0, 255);
        }
        if ("curTryOutCount".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "当前试模次数", isNull, 0, 255);
        }
        if ("totalNum".equals(key)) {
            // 判断参数类型: String  num boolean datetime
            result += CheckUtil.checkString(value == null ? "" : value.toString(), "总条数", isNull, 0, 255);
        }
        if ("dataList".equals(key)) {
            result += CheckUtil.checkJSONArray(JSONArray.parseArray(JSON.toJSONString(value)), "dataList", isNull);
        }
        if (isNull) {
            set.add(key);
        }
        return result;
    }

    private static String moldListACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add("pageNum");
        list.add("pageSize");
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "入参");
    }

    private static String moldListACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "出参");
    }

    private static String addMoldACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add("moldWeight");
        list.add("moldId");
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "入参");
    }

    private static String addMoldACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "出参");
    }

    private static String editMoldACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add("moldId");
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "入参");
    }

    private static String editMoldACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "出参");
    }

    private static String deleteMoldACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        list.add("moldId");
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "入参");
    }

    private static String deleteMoldACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "出参");
    }

    private static String queryMoldByNameACS(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "入参");
    }

    private static String queryMoldByNameACB(Set<String> set) {
        List<String> list = new ArrayList<>();
        if (set.size() == list.size()) {
            return "";
        }
        return getCollectionDifferentValue(list, set, "出参");
    }

    /**
     * 获取集合中的不同值
     *
     * @param list
     * @param set
     * @return
     */
    private static String getCollectionDifferentValue(List<String> list, Set<String> set, String flag) {
        String result = "";
        for (String str : list) {
            if (!set.contains(str)) {
                result += str + ",";
            }
        }
        if (StringUtils.isNotEmpty(result)) {
            result = StringUtils.strip(result, ",");
            result = "---" + flag + ":" + result + "为必填参数";
        }
        return result;
    }
}
